An overview of operator properties
import matplotlib.pyplot as plt
from numpy import sqrt,cos,sin,arange,pi
from qutip import *
%matplotlib inline
H = Qobj([[1],[0]])
V = Qobj([[0],[1]])
P45 = Qobj([[1/sqrt(2)],[1/sqrt(2)]])
M45 = Qobj([[1/sqrt(2)],[-1/sqrt(2)]])
R = Qobj([[1/sqrt(2)],[-1j/sqrt(2)]])
L = Qobj([[1/sqrt(2)],[1j/sqrt(2)]])
We already have the $|H\rangle$ state represented as a vector in the HV basis, so the $\hat{P}_H$ operator is the outer product $|H\rangle\langle H|$ (a ket then a bra):
H
Ph = H*H.dag()
Ph
Same with the $\hat{P}_V$ operator:
Pv = V*V.dag()
Pv
identity(2)
Ph + Pv == identity(2)
True
P45*P45.dag()
M45*M45.dag()
P45*P45.dag() + M45*M45.dag()
L*L.dag()
R*R.dag()
L*L.dag() + R*R.dag()
def Rp(theta):
return Qobj([[cos(theta),-sin(theta)],[sin(theta),cos(theta)]]).tidyup()
Rp(pi/2)
V==Rp(pi/2)*H
True
# Solution Goes Here
H==Rp(-pi/2)*V
True
# Solution Goes Here
# 4.6
(Rp(pi/2) + Rp(pi/3)) * P45 == Rp(pi/2)*P45 + Rp(pi/3)*P45
True
#4.7
Rp(pi/3)*(P45 + H) == Rp(pi/3)*P45 + Rp(pi/3)*H
True
#4.16
H.dag()*Rp(pi/4).dag() == P45.dag()
True
#4.18
dag(Rp(pi/3)*Rp(pi/4)) == (Rp(pi/3)*Rp(pi/4)).dag() == Rp(pi/4).dag()*Rp(pi/3).dag()
True
#4.22
Rp(pi/3).dag() * Rp(pi/3) == identity(2)
True
#4.27
Rp(pi/3).dag() == Rp(-pi/3)
True
The following defines a function that creates a similarity transform matrix. It takes the two old basis vectors and the two new basis vectors as arguments. To apply the transform, simply multiply the matrix onto the state vector or ooperator matrix. Following the examples below, explore this transform.
def sim_transform(o_basis1, o_basis2, n_basis1, n_basis2):
a = n_basis1.dag()*o_basis1
b = n_basis1.dag()*o_basis2
c = n_basis2.dag()*o_basis1
d = n_basis2.dag()*o_basis2
return Qobj([[a.data[0,0],b.data[0,0]],[c.data[0,0],d.data[0,0]]])
We can define a similarity transform that converts from $HV\rightarrow \pm 45$
Shv45 = sim_transform(H,V,P45,M45) # as found in Example 4.A.1, Eq. 4.A.10.
Shv45
Shv45 * H # compare to Eq. 4.A.12
Shv45 * V
Check your answer against Eqns. 4.A.17 and 4.72
Shv45 * Ph * Shv45.dag()
Shv45 * Pv * Shv45.dag()